<extend name="Layout:form" />
<block name="title"><title>添加菜单</title></block>
<block name="subnav">
    <a class="add fb" href="__MODULE__/Menu/add"><em>添加菜单</em></a>　    <a href="__MODULE__/Menu/index"><em>菜单管理</em></a>
</block>
<block name="main">
    <form name="myform" id="myform" action="__MODULE__/Menu/add" method="post">
        <table cellpadding=0 cellspacing=0 class="table_form" width="100%">
            <tr>
                <td width="200px" align="right">是否需要判断请求方式:</td>
                <td>
                    <label style="float:left;width:75px">
                        <input type="radio" class="input_radio " name="info[request_method]" checked value="0"> 否
                    </label>
                    <label style="float:left;width:75px">
                        <input type="radio" class="input_radio " name="info[request_method]"  value="1" > 是
                    </label>
                </td>
            </tr>
            <tr>
                <td width="200px" align="right">上级菜单:</td>
                <td>
                    <select id="pid" name="info[pid]">
                        <option value="0" <?php if (!isset($_GET['menu_id']) || $_GET['menu_id'] == 0){echo "selected";} ?>>顶级菜单</option>
                        <?php foreach ($menus as $key => $menu) { ?>
                        <option value="<?php echo $menu['id']; ?>" <?php if (isset($_GET['menu_id']) && $_GET['menu_id'] == $menu['id']){echo "selected";} ?>><?php echo cat_empty_deal($menu, (isset($menus[$key+1]) ? $menus[$key+1]['pid'] : ''), 'pid', "&nbsp;&nbsp;&nbsp;").$menu['title']; ?></option>
                        <?php } ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td width="200px" align="right">菜单名:</td>
                <td>
                    <input type="text" class="input-text" name="info[title]" id="title" value="" size="40"/>
                </td>
            </tr>
            <tr>
                <td width="200px" align="right">模块名:</td>
                <td>
                    <input type="text" class="input-text " name="info[module]" id="module" value="" size="40"/>
                    <span id="for_module" ></span>
                </td>
            </tr>
            <tr>
                <td width="200px" align="right">方法名:</td>
                <td>
                    <input type="text" class="input-text " name="info[action]" id="action" value="" size="40"/>
                </td>
            </tr>
            <tr>
                <td width="200px" align="right">URL附加参数:</td>
                <td>
                    <input type="text" class="input-text" name="info[params]" value="" size="40"/>
                </td>
            </tr>
            <tr>
                <td width="200px" align="right">排序:</td>
                <td>
                    <input type="text" class="input-text" name="info[sort]" value="0" size="40"/>
                </td>
            </tr>
            <tr>
                <td width="200px" align="right">状态:</td>
                <td>
                    <label style="float:left;width:75px">
                        <input type="radio" class="input_radio " name="info[status]" id="status_1" checked value="1"> 启用
                    </label>
                    <label style="float:left;width:75px">
                        <input type="radio" class="input_radio " name="info[status]" id="status_2"  value="0" > 禁用
                    </label>
                </td>
            </tr>
            <tr>
                <td width="200px" align="right">描述:</td>
                <td><textarea name="info[remark]" rows="3" cols="60" id="remark"/></textarea>
                </td>
            </tr>
        </table>
        <div class="bk15"></div>
        <div class="btn">
            <input type="submit" name="dosubmit" id="dosubmit" value="提交" class='button'>&nbsp;<input type="reset" value="重置" class='button'>
        </div>
    </form>
</block>

<block name="footer">
    <script type="text/javascript">
        $(function() {
            $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true}, function(){this.close();$(obj).focus();})}});
            $("#title").formValidator({onshow:"请输入对应的中文语言名称",onfocus:"请输入对应的中文语言名称",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入对应的中文语言名称"});
            $("#module").formValidator({onshow:"请输入模块名",onfocus:"请输入模块名",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入模块名"});
            $("#action").formValidator({tipid:'a_tip',onshow:"请输入方法名",onfocus:"请输入方法名",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入方法名"});
        });
    </script>
</block>